﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Agile.Paypal
{
    public class CreditCardInfo
    {
        private CreditCardType _type;
        public CreditCardType Type
        {
            get { return _type; }
            set
            {
                if (!Enum.GetValues(typeof(CreditCardType)).Cast<CreditCardType>().Contains(value))
                {
                    throw new ArgumentException("Invalid card type", "value");
                }

                _type = value;
            }
        }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string Number { get; set; }
        public string Cvv2 { get; set; }
        private int _year;
        private int _month;
        public int ExpirationYear
        {
            get { return _year; }
            set
            {
                if (value < 2000)
                    throw new ArgumentOutOfRangeException("value", "Invalid year");

                _year = value;
            }
        }

        public int ExpirationMonth
        {
            get { return _month; }
            set
            {
                if (value < 1 || value > 12)
                    throw new ArgumentOutOfRangeException("value", "Invalid month");

                _month = value;
            }
        }
    }
}
